/**
 * A basic node class for use within linked lists
 */

public class Node<T>
{
	
	private T data;
	private Node<T> next;
	
	public Node(T data, Node<T> next)
	{
		setData(data);
		setNext(next);
	}
	
	public void setData(T data)
	{
		this.data = data;
	}
	
	public T getData()
	{
		return data;
	}
	
	public void setNext(Node<T> next)
	{
		this.next = next;
	}
	
	public Node<T> getNext()
	{
		return next;
	}
	
	public String toString()
	{
		return data + (next != null ? " | " + next : "");
	}
	
}